import { getCurrentInstance  } from "vue";


/**
 * @description 获取路由参数公共方法 适配环境 H5 | WEIXIN
 *
 */
export const getRouterQuery = () => {
  if (uni.getSystemInfoSync().uniPlatform  === "mp-weixin") {
    const pages = getCurrentPages();
    const currentRoute:any = pages[pages.length - 1]
    // console.log("获取当前环境", uni.getSystemInfoSync(), currentRoute);
    return currentRoute.options;
  } else {
    const instance: any = getCurrentInstance();
    // console.log("获取当前环境", uni.getSystemInfoSync(), getCurrentInstance())
    return instance.attrs;
  }
};
